﻿var thisspan = null;
var pwdStrength = function(text){
    var spanarr = $(".password-strength span");
    var strength = 0;
    if (text.length<6) {
	    strength = 1;
    }
    else {
	    var stre1 = (text.search(/[a-zA-Z]/)!=-1) ? 1 : 0;
	    var stre2 = (text.search(/[0-9]/)!=-1) ? 1 : 0;
	    var stre3 = (text.search(/[^A-Za-z0-9_]/)!=-1) ? 1 : 0;
	    var strength = stre1 + stre2 + stre3;
    }
    if(thisspan){
        thisspan.className = '';
    }
    if(strength>0){
        spanarr[strength-1].className ='current';
        thisspan = spanarr[strength-1];
    }    
};